feat: Add metadata
field on the certificate
#151
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Metadata field
This PR adds a
Metadata
field to certificate. This field is aHash
field, that different chains can use to store arbitrary data relevant to them. In our case, we store the the number of block on L2 until which we built the given certificate.For example, we built a certificate for blocks 10 to 20 on L2. We will store number 20 in a form of hash to the
Metadata
field on the certificate.Once the
agglayer
team introduces the rpc endpoint to get the last sent certificate by our network, we can use that field to know from which block to build the next certificate. For now, we use a local database on theaggsender
for this, but we want to avoid cases where we might lose our local db, or it gets corrupted, or we missed a lot of blocks.Invalid signer issue
This PR also fixes the issue of signing a wrong certificate hash, which caused the
InvalidSigner
problem on theagglayer
.agglayer
signs the same data as inHashToSign
function.Global index on imported bridge exits is first converted to little endian slice, and then hashed, as per
agglayer
code.